<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/motionLayout"
    app:layoutDescription="@xml/motion_scene_animeinfo">




    <com.ms.square.android.expandabletextview.ExpandableTextView
        xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
        android:id="@+id/animeInfoSummary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="30dp"
        android:layout_marginTop="20dp"
        android:layout_marginEnd="20dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/animeInfoRoot"
        expandableTextView:animDuration="200"
        expandableTextView:maxCollapsedLines="2">

        <TextView
            android:id="@id/expandable_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/plot_summary"
            tools:text="asasasasaaaaaaaaaaaaaaaaaaaaaa" />

        <ImageButton
            android:id="@id/expand_collapse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|end"
            android:layout_marginEnd="16dp"
            android:background="@android:color/transparent"
            android:visibility="invisible" />
    </com.ms.square.android.expandabletextview.ExpandableTextView>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/animeInfoRoot"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:layout_marginStart="30dp"
        android:layout_marginTop="10dp"
        android:layout_marginEnd="20dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/topView">

        <androidx.cardview.widget.CardView
            android:id="@+id/animeCardView"
            android:layout_width="128dp"
            android:layout_height="210dp"
            app:cardCornerRadius="4dp"
            app:cardElevation="0dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/animeInfoImage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop" />

        </androidx.cardview.widget.CardView>

        <TextView
            android:id="@+id/animeInfoTitle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/anime_info_item_start_margin"
            android:layout_marginBottom="10dp"
            android:fontFamily="sans-serif-medium"
            android:maxLines="2"
            android:textColor="@color/info_anime_title"
            android:textSize="18sp"
            app:layout_constraintBottom_toTopOf="@+id/typeLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@id/animeCardView"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_chainStyle="packed"
            tools:text="BAKUSOU KYOUDAI LET'S GO WGP" />

        <LinearLayout
            android:id="@+id/typeLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/anime_info_item_start_margin"
            android:layout_marginBottom="@dimen/anime_info_item_spacing"
            android:orientation="horizontal"
            app:layout_constraintBottom_toTopOf="@+id/releasedLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@id/animeCardView"
            app:layout_constraintTop_toBottomOf="@+id/animeInfoTitle">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLines="1"
                android:text="@string/type"
                android:theme="@style/type_title" />

            <TextView
                android:id="@+id/animeInfoType"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:theme="@style/type_value"
                tools:text="TV Series" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/releasedLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/anime_info_item_start_margin"
            android:layout_marginBottom="@dimen/anime_info_item_spacing"
            android:orientation="horizontal"
            app:layout_constraintBottom_toTopOf="@+id/statusLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@id/animeCardView"
            app:layout_constraintTop_toBottomOf="@+id/typeLayout">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLines="1"

                android:text="@string/released"
                android:theme="@style/type_title" />

            <TextView
                android:id="@+id/animeInfoReleased"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:theme="@style/type_value"
                tools:text="TV Series" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/statusLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/anime_info_item_start_margin"
            android:layout_marginBottom="@dimen/anime_info_item_spacing"
            android:orientation="horizontal"
            app:layout_constraintBottom_toTopOf="@+id/flowLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@id/animeCardView"
            app:layout_constraintTop_toBottomOf="@+id/releasedLayout">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLines="1"
                android:text="@string/status"
                android:theme="@style/type_title" />

            <TextView
                android:id="@+id/animeInfoStatus"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:theme="@style/type_value"
                tools:text="Completed" />
        </LinearLayout>

        <org.apmem.tools.layouts.FlowLayout
            android:id="@+id/flowLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="15dp"
            android:layout_marginTop="5dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@id/animeCardView"
            app:layout_constraintTop_toBottomOf="@+id/statusLayout" />

    </androidx.constraintlayout.widget.ConstraintLayout>



    <com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
        android:id="@+id/animeInfoRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:clipToPadding="false"
        android:paddingStart="20dp"
        android:paddingTop="20dp"
        android:paddingEnd="20dp"
        android:paddingBottom="20dp"
        app:fastScrollPopupBgColor="@color/colorAccent"
        app:fastScrollPopupTextColor="@android:color/primary_text_dark"
        app:fastScrollThumbColor="@color/colorAccent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/animeInfoSummary" />

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/topView"
        app:cardElevation="0dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
       app:cardBackgroundColor="@color/app_background">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:layout_marginEnd="20dp"
            android:padding="10dp">


            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="30dp"
                android:layout_height="30dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                android:background="?selectableItemBackgroundBorderless"
                android:clickable="true"
                android:focusable="true"
                android:paddingStart="4dp"
                android:paddingEnd="4dp"
                android:id="@+id/back"
                app:srcCompat="@drawable/ic_arrow"
                android:tint="@color/info_back" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@id/back"
                android:layout_toStartOf="@id/favourite"
                android:textSize="20sp"
                android:textColor="@color/info_anime_title"
                android:gravity="center_vertical"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toEndOf="@id/back"
                app:layout_constraintEnd_toStartOf="@id/favourite"
                android:layout_marginEnd="10dp"
                android:layout_marginStart="20dp"
                android:ellipsize="end"
                android:alpha="0"
                android:maxLines="1"
                android:id="@+id/toolbarText"
                />
            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="30dp"
                android:layout_height="30dp"

                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:background="?selectableItemBackgroundBorderless"
                android:id="@+id/favourite"
                android:clickable="true"
                android:focusable="true"
                android:paddingStart="5dp"
                android:paddingEnd="5dp"
                android:visibility="gone"
                app:srcCompat="@drawable/ic_unfavorite" />


        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>
    <include
        layout="@layout/loading"
        />
    <!--    <TextView-->
    <!--        android:layout_width="0dp"-->
    <!--        android:layout_height="wrap_content"-->
    <!--        android:id="@+id/animeInfoSummary"-->
    <!--        app:layout_constraintEnd_toEndOf="parent"-->
    <!--        app:layout_constraintStart_toStartOf="parent"-->
    <!--        app:layout_constraintTop_toBottomOf="@id/animeInfoRoot"-->
    <!--        android:layout_marginStart="30dp"-->
    <!--        android:layout_marginTop="20dp"-->
    <!--        android:layout_marginEnd="20dp"-->
    <!--        />-->


</androidx.constraintlayout.motion.widget.MotionLayout>